import type { Component } from 'vue'
import type { ComponentType, ComponentCategory } from '@/types'

// 插件组件元数据
export interface PluginComponentMeta {
  type: ComponentType
  category: ComponentCategory
  label: string
  icon?: Component | string
  group?: string
}

// 插件组件属性
export interface PluginComponentProps {
  base?: Record<string, any>
  style?: Record<string, any>
  baseSchema?: Record<string, any>
  styleSchema?: Record<string, any>
}

// 插件组件
export interface PluginComponent {
  metadata: PluginComponentMeta
  props: PluginComponentProps
  template: string
  virtual?: boolean
}

// 插件配置
export interface PluginConfig {
  name: string
  version: string
  components: PluginComponent[]
}

// 插件管理器配置
export interface PluginManagerConfig {
  allowVirtual: boolean
  validateMetadata: boolean
  onError?: (error: Error) => void
}

// 插件接口
export interface Plugin {
  config: PluginConfig
  setup?: () => Promise<void>
  destroy?: () => Promise<void>
}

// 虚拟组件定义（无需实体组件文件）
export interface VirtualComponent {
  type: string
  template: string
  props?: Record<string, any>
  events?: string[]
  slots?: string[]
}

// 插件组件定义
export interface PluginComponentDefinition {
  name: string
  component?: Component
  virtual?: VirtualComponent
} 